<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="add">
    <hello></hello>
    <hello></hello>
    <hello></hello>
    <counter></counter>
</div><br>
<div id="acc">
    <counter></counter>
</div>
</body>
<script src="node_modules/vue/dist/vue.js"></script>
<script>
    Vue.component("hello", {
        template: '<button v-on:click="num++">点击++{{num}}</button>',
        data() {
            return {
                num: 0
            }
        }
    })
    const counter = {
        template:'<button v-on:click="count++">你点了我 {{ count }} 次，我记住了.</button>',
        data(){
            return {
                count:0
            }
        }
    };
    var add = new Vue({
        el: '#add'

    })
    var acc=new Vue({
        el:'#acc',
        components:{
            counter:counter // 将定义的对象注册为组件
        }
    })
</script>
</html>